import 'babel-polyfill'

import Vue from 'vue'
import VueLazyload from 'vue-lazyload'
import { FastClick } from 'utils'
import 'vue-swipe/dist/vue-swipe.css'

import App from './App'
import router from './router'
import store from './store'

// directive
import InfiniteScroll from './directive/infinite-scroll'
import sticky from './directive/sticky'
import title from './directive/title'
import { analytics } from './directive/analytics'

// 加载全局css
import './styles/base.scss'

FastClick.attach(document.body)

const placeholder = require('assets/common/placeholder.png')

Vue.directive('InfiniteScroll', InfiniteScroll)
Vue.directive('title', title)
Vue.directive('sticky', sticky)
Vue.directive('analytics', analytics)
Vue.use(VueLazyload, {
  preLoad: 1.3,
  loading: placeholder,
  error: placeholder,
  attempt: 1,
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App },
})
